﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Text;
using System.Threading.Tasks;

namespace Get_NAV
{
    public sealed class Apptools
    {
        public PSCommand Commands { get; set; }

        #region Apptools

        public void ExportNAVAppPermissionSet(string path, string permissionSetId, string serverInstance)
        {
            Command exportCommand = new Command("Export-NAVAppPermissionSet");
            exportCommand.Parameters.Add("Path", path);
            exportCommand.Parameters.Add("PermissionSetId", permissionSetId);
            exportCommand.Parameters.Add("ServerInstance", serverInstance);

            Commands.AddCommand(exportCommand);
        }

        public void GetNAVAppManifest(string path)
        {
            Command getCommand = new Command("Get-NAVAppManifest");
            getCommand.Parameters.Add("Path", path);

            Commands.AddCommand(getCommand);
        }

        public void NewNAVAppManifest(string name, string publisher)
        {
            Command newCommand = new Command("New-NAVAppManifest");
            newCommand.Parameters.Add("Name", name);
            newCommand.Parameters.Add("Publisher", publisher);

            Commands.AddCommand(newCommand);
        }

        public void NewNAVAppManifestFile(string manifest, string path)
        {
            Command newCommand = new Command("New-NAVAppManifestFile");
            newCommand.Parameters.Add("Manifest", manifest);
            newCommand.Parameters.Add("Path", path);

            Commands.AddCommand(newCommand);
        }

        public void NewNAVAppPackage(string manifest, string path, string sourcePath)
        {
            Command newCommand = new Command("New-NAVAppPackage");
            newCommand.Parameters.Add("Manifest", manifest);
            newCommand.Parameters.Add("Path", path);
            newCommand.Parameters.Add("SourcePath", sourcePath);

            Commands.AddCommand(newCommand);
        }

        public void SetNAVAppManifest(string manifest)
        {
            Command setCommand = new Command("Set-NAVAppManifest");
            setCommand.Parameters.Add("Manifest", manifest);

            Commands.AddCommand(setCommand);
        }

        #endregion Apptools
    }
}
